<template>
  <!--v-bind: $attrs 绑定透传的数据-->
  <component :is="type" v-model="value" v-bind="$attrs" />
</template>

<script>
export default {
  name: 'base-input',
  data() {
    let type = this.$attrs.type || 'a-input'
    return {
      type,
      value: ''
    }
  },
  mounted() {
    if (this.$attrs.defaultValue) {
      this.value = this.$attrs.defaultValue
    }
  }
}
</script>
